package com.jijuxie.message.utils;

import com.jijuxie.message.service.IMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

@Component
public class MessageUtils {

    @Autowired
    private IMessageService messageService;

    /**
     * 异步发送系统通知
     */
    @Async
    public void sendSystemMessageAsync(Long userId, String title, String content) {
        messageService.sendSystemMessage(userId, title, content);
    }

    /**
     * 异步发送预约通知
     */
    @Async
    public void sendAppointmentMessageAsync(Long userId, Long appointmentId) {
        messageService.sendAppointmentMessage(userId, appointmentId);
    }

    /**
     * 异步发送成交通知
     */
    @Async
    public void sendDealMessageAsync(Long userId, Long dealId) {
        messageService.sendDealMessage(userId, dealId);
    }
}
